/*
 * p4249.cpp
 *
 *  Created on: 2013-10-28
 *      Author: zy
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int a[15], b[15], c[15];
long long dp[10][10][10][10];
int len1, len2, len3;
stack<int> st;
long long DP()
{
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i <= 9; i++)
	{
		if (a[0] != -1 && a[0] != i)
			continue;
		for (int j = 0; j <= 9; j++)
		{
			if (b[0] != -1 && b[0] != j)
				continue;
			for (int k = 0; k <= 9; k++)
			{
				if (c[0] != -1 && c[0] != k)
					continue;
				if ((i + j) % 10 == k)
					dp[0][i][j][k] = 1;
			}

		}
	}
	for (int l = 1; l < len3; l++)
		for (int i = 0; i <= 9; i++)
		{
			if (a[l] != -1 && a[l] != i)
				continue;
			if (l == len1 - 1 && i == 0)
				continue;
			for (int j = 0; j <= 9; j++)
			{
				if (b[l] != -1 && b[l] != j)
					continue;
				if (l == len2 - 1 && j == 0)
					continue;
				for (int k = 0; k <= 9; k++)
				{
					if (c[l] != -1 && c[l] != k)
						continue;
					if (l == len3 - 1 && k == 0)
						continue;
					if ((i + j) % 10 == k)
					{
						for (int ii = 0; ii <= 9; ii++)
							for (int jj = 0; jj <= 9; jj++)
								for (int kk = 0; kk <= 9; kk++)
									if (ii + jj == kk || ii + jj + 1 == kk)
										dp[l][i][j][k] += dp[l - 1][ii][jj][kk];
					}
					if ((i + j + 1) % 10 == k)
					{
						for (int ii = 0; ii <= 9; ii++)
							for (int jj = 0; jj <= 9; jj++)
								for (int kk = 0; kk <= 9; kk++)
									if (ii + jj >= 10 && (ii + jj) % 10 == kk
											|| ii + jj + 1 >= 10 && (ii + jj
													+ 1) % 10 == kk)
										dp[l][i][j][k] += dp[l - 1][ii][jj][kk];
					}
				}

			}
		}
	long long ans = 0;
	for (int i = 0; i <= 9; i++)
		for (int j = 0; j <= 9; j++)
			for (int k = 0; k <= 9; k++)
				if (((i + j) == k || i + j + 1 == k) && dp[len3 - 1][i][j][k]
						!= 0)
				{
					ans += dp[len3 - 1][i][j][k];
					//printf("%d %d %d %lld\n", i, j, k, dp[len3 - 1][i][j][k]);
				}
	return ans;

}
int main()
{
	char s[50];
	int cas = 0;
	while (scanf("%s", s) != EOF)
	{
		int i;
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		memset(c, 0, sizeof(c));
		for (i = 0; s[i] != '+'; i++)
			st.push(s[i]);
		len1 = 0;
		while (!st.empty())
		{
			if (st.top() != '?')
				a[len1++] = st.top() - '0';
			else
				a[len1++] = -1;
			st.pop();
		}
		for (i++; s[i] != '='; i++)
			st.push(s[i]);

		len2 = 0;
		while (!st.empty())
		{
			if (st.top() != '?')
				b[len2++] = st.top() - '0';
			else
				b[len2++] = -1;
			st.pop();
		}
		for (i++; s[i] != 0; i++)
			st.push(s[i]);
		len3 = 0;
		while (!st.empty())
		{
			if (st.top() != '?')
				c[len3++] = st.top() - '0';
			else
				c[len3++] = -1;
			st.pop();
		}
		printf("Case %d: ", ++cas);
		if (len3 >= max(len1, len2))
			cout << DP() << endl;
		else
			printf("0\n");

	}
	return 0;
}
